package com.ai.web.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ai.web.service.QrcodeService;
import com.ai.web.vo.QrcodeV;
import com.ai.web.vo.ResultModel;
import com.tiny.persistence.domain.Qrcode;
import com.tiny.persistence.repository.QrcodeRepo;

@Service
public class QrcodeServiceImpl extends BaseServiceImpl<Qrcode, Integer, QrcodeV> implements QrcodeService  {

    @Autowired
    private QrcodeRepo qrcodeRepo;
    
    @Autowired
    public QrcodeServiceImpl(QrcodeRepo qrcodeRepo) {
        super(qrcodeRepo);
    }

	public int getMaxId(String serialNumber) {
		return qrcodeRepo.getMaxId(serialNumber);
	}

	public ResultModel save(QrcodeV qrcodeV) throws Exception{
		QrcodeV saveV = saveT(qrcodeV);
		
		ResultModel rm = new ResultModel();
		rm.setData(saveV);
		rm.setSuccessCode();
		
		return rm;
	}

	public QrcodeV getQrcode(Integer id) throws Exception {
		return getT(id);
	}
}
